<?php

namespace App\Admin\Controllers;

use App\Models\Suggestion;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class SuggestionController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '意见反馈';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new Suggestion);
        $grid->model()->latest();
        $grid->disableCreateButton();
        $grid->disableColumnSelector();
        $grid->disableActions();
        $grid->disableFilter();
        $grid->disableExport();
        $grid->disableRowSelector();

        $grid->column('id', "ID");
        $grid->column('type', "类型")->display(function ($type) {
            return ["其他","咨询","建议"][$type] ?? "其他";
        });;
        $grid->column('email', "邮箱");
//        $grid->column('mobile', "手机号");
        $grid->column('third_party', "QQ/微信/其他");
        $grid->column('content', "内容");
        $grid->column('created_at', "提交时间");

        return $grid;
    }
}
